<!DOCTYPE html>
<html>
	<head>
		#include('head.html',{title:'搜索'})
		<style type="text/css">
			.sea-inpleft{
				margin-left: 15px;
			}
			body{
				background-image: url(images/bgc.jpg);
			}
			/*hr{
				border-top:black;
			}*/
			button{
				/*margin-top: 5px;*/
				margin: 5px 8px;
			}
			h3{
				margin-left: 10px;
			}
			.am-btn.am-round {
				margin-bottom: 10px;
			}
			.searchhistory{
				color: #666;
				background-color: #eee;
				font-size: 1.4rem;
				border-radius: 10px!important;
			}
			.clearbtn{
				float: right;
				margin-right: 10px;
				font-size: 15px;
				line-height: 30px;
				color: #03A9F4;
				cursor: pointer;
			}
			html{
				height: auto;
			}
			.search-input a i{
				margin-top: 4px;
			}
		</style>
	</head>
	<body>

	<div class="search-input">
		<a href="javascript:history.back()" id="back"><i class="fl am-success am-icon-chevron-left "></i></a>
		<script>
            if (travel.checkApp()) {
                $("#back").remove();
            }
		</script>
		<input type="text" class="sea-inpleft searchInput" placeholder="请输入您搜索的内容" />
		<a onclick="mysearch()"><i class="fr am-success am-icon-search "></i></a>
	</div>#include('header.html')
	<hr>
	<div >
		<h3>热门搜索</h3>
		<div style="padding: 20px 10px;margin: 0 auto;text-align: center;">
			#set(i=1)
			#for(view : cViewList)
			#if(i==1||i==7||i==10)
			#set(s="primary")
			#elseif(i==2||i==4||i==12)
			#set(s="success")
			#elseif(i==3||i==8||i==9)
			#set(s="warning")
			#elseif(i==0||i==6||i==11)
			#set(s="danger")
			#elseif(i==5)
			#set(s="secondary")
			#end
			<button type="button" onclick="javascript:location.href='detail?vId=${view.vId}';" class="am-btn am-btn-sm am-round am-btn-${s}">${view.vName}</button>
			#set(i=i+1)
			#end
		</div>

	</div>
	<hr>
	<div>
		<h3>搜索历史 <span class="clearbtn">清除</span></h3>
		<div style="padding: 20px 10px;margin: 0 auto;text-align: center;" id="searchHistory">
			#for( search : searchList)
			<button type="button" onclick="javascript:location.href='searchResult?s=${search}'" class="am-btn am-btn-sm am-round searchhistory">${search}</button>
			#end
			#if(searchList==null)
			<p style="color: #dedede;font-style: italic;">暂无记录</p>
			#end
		</div>
	</div>
	<script>
        $(".clearbtn").click(function () {
            $.ajax({
                url:"clearSearch",
                dataType:"json",
                type:"post",
                data: null,
                success:function(result){
                    if(result.status=="1"){
                       $("#searchHistory").html("<p style=\"color: #dedede;font-style: italic;\">暂无记录</p>");
                    }
                    else {
                        alert(''+result.tips);
                    }
                },
                error:function(result){
                    console.log(result);
                    alert('系统繁忙！');
                }
            });
        });
        function mysearch() {
            var a = $(".searchInput").val();
            if(a!="")
				location.href="searchResult?s="+a;
        }
	</script>
	</body>
</html>
